package com.pomelo.tiku.adapters;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

import com.pomelo.tiku.R;

import java.util.List;

/**
 * @author liuxiangwang
 * @date .
 */
public class HomeVacationAdapter extends BaseAdapter<String>{
    private TextView tv_vacation;
    private int currentPosition = 0; //索引
    private Context mContext;

    public HomeVacationAdapter(Context context,List<String> list) {
        super(list);
       this.mContext = context;
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        super.onBindViewHolder(holder, position);
        if(currentPosition==position && tv_vacation != null){
            tv_vacation.setTextColor(mContext.getResources().getColor(R.color.white));
        }else {
            tv_vacation.setTextColor(mContext.getResources().getColor(R.color.home_radio_button_bg_color));
        }
    }

    public void setCurrentPosition(int postition) {
        currentPosition = postition;

        notifyDataSetChanged();
    }

    @Override
    public void onBindView(List<String> list, String data, int pos, RecyclerView.ViewHolder holder, Context context, View view) {
        tv_vacation = view.findViewById(R.id.tv_vacation);
        tv_vacation.setText(data);
    }

    @Override
    public int setLayout() {
        return R.layout.item_home_vacation_layout;
    }
}
